-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync bundle row state and bundle detail state #4246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the stateInfo
terminology might be confusing, because state
is a specific field within a bundle...
Could you describe at a high-level what the fix was? |
@percyliang the worksheet view fetches basic bundle info on an interval in order to keep the rows up-to-date. The BundleDetail view also fetches basic bundle info on an interval (as well as more detailed information that the worksheet view doesn't need to fetch). The issue is that the fetching isn't synced, so the fix I implemented is to allow the worksheet to dictate what state to display in the bundle detail view if necessary. Note that I've updated some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Would you mind updating the code with a comment that describes how the bundle information gets propagated from the table to the bundle detail page to keep things synchronized?
frontend/src/components/worksheets/items/TableItem/BundleRow.js
Outdated
Show resolved
Hide resolved
@percyliang refactored a bit. lmk if this works |
} | ||
return []; | ||
} | ||
|
||
showTime(time) { | ||
return time && time !== '<none>' && time !== '0s'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we should be able to access the raw value rather than the rendered one to avoid these rather brittle comparisons, so we could test whether time == null
or something...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will update the renderFormat
helper to allow for this 👍
* This enables the bundle row and the bundle detail sidebar to show the | ||
* exact same state information. | ||
*/ | ||
const syncBundleStateInfo = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only is called once, so why not just inline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like wrapping the logic in a named function makes it easier to figure out for someone else who might stumble across the code later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments, but overall looks good to me - thanks!
Reasons for making this change
The state shown in the bundle row is currently not synced with the state shown in the expanded bundle details. This change ensures that the bundle row and the expanded bundle details will always be in sync.
Related issues
#4174
Screenshots
Before (prod)
20220907142603545.mp4
After (local)
20220907142709524.mp4
Checklist